#ifndef _REGULARSOLDIERLIVING_TEST_H_
#define _REGULARSOLDIERLIVING_TEST_H_

#include "RegularSoldierLiving.h"

#include "gmock/gmock.h"
#include "gtest/gtest.h"

/**
 * Test the basic functionality of healing, hurting, setting health,
 * getting health.
 */
TEST(RegularSoldierLiving, healthFunctions)
{
  const int healthOf = 15;
  const int basicDamage = 10;
  RegularSoldierLiving l;

  EXPECT_TRUE(healthOf == l.getHealth());

  l.hurt(basicDamage);

  EXPECT_TRUE((healthOf - basicDamage) == l.getHealth());

  l.heal(healthOf);

  EXPECT_TRUE((healthOf - basicDamage + healthOf) == l.getHealth());
}

/**
 * Checks if kill function callback is called properly. By default,
 * it takes the object reference, so we can check the data provided.
 */
const int NEIGHBOUR = 665;
void fun_regularSoldier_callback(ILiving* ptr)
  {
    /* Set the health so we know we had some fun with it */
     ptr->heal(NEIGHBOUR);
  }

TEST(RegularSoldierLiving, killCallback)
{
  const int baseHealth = 15;
  const int dmg = 45;
  RegularSoldierLiving l;

  l.setKillCallback(fun_regularSoldier_callback);
  l.hurt(dmg);

  EXPECT_TRUE(baseHealth - dmg + NEIGHBOUR == l.getHealth());
}
#endif /* _REGULARSOLDIERLIVING_TEST_H_ */

